<?php
class BaseModelMessage {
 	/**
	* message page
	* @param string $msg
	* @param tinyint $type, in set('close', 'next', 'back')
	* @param string $url, go back url
	* @param int $second, after second go url page
	* @return view template
	*/    
	public static function showMessage($msg, $act = 'back', $url = '/', $second = 3, $type='html') {
		$tpl = new View();
		$tpl->assign("msg", $msg);
		$tpl->assign("type", $act);
		$tpl->assign("url", $url);
		$tpl->assign("second", $second);
		$tpl->display("error/Message.html");
    }
    /**
	* erorr page
	* @param string $msg
	* @param tinyint $type, in set('close', 'next', 'back')
	* @param string $url, go back url
	* @param int $second, after second go url page
	* @return view template
	*/
    public static function showError($msg, $url = '/', $title = '出错啦', $act = 'back', $second = 3) {
		switch (OUTPUTSTYLE) {
			case 'json': echo json_encode(array('ret'=>0, 'reason'=>$msg)); return;
		}		
		$tpl = new View();
		$tpl->assign('title', $title);
		$tpl->assign("msg", $msg);
		$tpl->assign("type", $act);
		$tpl->assign("url", $url);
		$tpl->assign("second", $second);
		$tpl->display("error/Error.html");
    }
}
?>